﻿@using EC.Entity.Response.Merchant
@using EC.Entity.Enum

@model EC.Entity.PagedList<MerchantQueryResponse>
<div class="data-body data-scroll">
    <div class="data-view">
        <div class="data-div-view table-responsive">
            <table class="table table-hover table-striped table-bordered">
                <thead>
                    <tr>
                        <th class="t_l">代理</th>
                        <th class="t_c wd400">代理商户</th>
                        <th class="t_c wd75">状态</th>
                        <th class="t_c wd175">操作</th>
                    </tr>
                </thead>
                <tbody>
                    @if (Model != null && Model.TData != null && Model.TData.Any())
                    {
                        foreach (var item in (IEnumerable<MerchantQueryResponse>)Model.TData)
                        {
                    <tr>
                        <td class="t_l">@(item.Name)</td>
                        <td class="t_c wd400">@(item.ProxyName)</td>
                        <td class="t_c wd75">
                            @(item.Status == (sbyte)UserGroupStatus.启用 ? Html.Raw("<span class='green bold'>启用</span>") : Html.Raw("<span class='red bold'>禁用</span>"))
                        </td>
                        <td class="t_c wd175">
                            @if (item.Status == (sbyte)UserGroupStatus.启用)
                            {
                                <a class="btn btn-danger btn-xs" data-confirm="确定要禁用该代理？" data-succesFun="doSearch()" data-href="/Merchant/UpdateStatus?id=@(item.Id)&status=@((sbyte)UserGroupStatus.禁用)">禁用</a>
                            }
                            else
                            {
                                <a class="btn btn-primary btn-xs" data-confirm="确定要启用该代理？" data-succesFun="doSearch()" data-href="/Merchant/UpdateStatus?id=@(item.Id)&status=@((sbyte)UserGroupStatus.启用)">启用</a>
                            }

                            <button type="button" class="btn btn-default btn-xs" data-modal="/Merchant/Proxy?id=@(item.Id)" data-title="代理设置" data-width="500" data-height="200">
                                <span class="glyphicon glyphicon-edit"></span> 代理设置
                            </button>

                            <button type="button" class="btn btn-default btn-xs" data-modal="/Sy/FinanceEdit/@(item.Id)" data-title="编辑" data-width="452" data-height="120">
                                <span class="glyphicon glyphicon-edit"></span> 编辑
                            </button>
                        </td>
                    </tr>
                        }
                    }
                    else
                    {
                        <tr>
                            <td colspan="4" class="t_c">暂无记录</td>
                        </tr>
                    }
                </tbody>
            </table>
        </div>
    </div>
</div>
<!-- 必要的分页参数设置 -->
<input type="hidden" id="TotalCount" value="@(Model != null ? Model.TotalCount : 0)" />